package com.akk.module.avs.service;

import com.akk.module.avs.entity.AvsYbInfo;
import com.akk.module.avs.entity.AvsYbInfoExample;
import com.akk.module.avs.mapper.AvsYbInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class AvsYbInfoService {

    @Autowired
    private AvsYbInfoExample infoExample;

    @Autowired
    private AvsYbInfoMapper infoMapper;

    public List<AvsYbInfo> queryByParams(Map params){
        infoExample.clear();
        AvsYbInfoExample.Criteria criteria = infoExample.createCriteria();
        if (params.containsKey("appId"))
            criteria.andAppIdEqualTo(params.get("appId").toString());
        return infoMapper.selectByExample(infoExample);
    }

    public AvsYbInfo queryById(Long infoId){
        return infoMapper.selectByPrimaryKey(infoId);
    }

    public void save(AvsYbInfo info){
        infoMapper.insert(info);
    }

    public void update(AvsYbInfo info){
        infoMapper.updateByPrimaryKey(info);
    }

}
